<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>Test page for JavaScript Template Engine</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<script type="text/javascript" src="template.js"></script>
		<script type="text/javascript">
			function test() {
				var f = document.testform;
				var t = new Template();
//				t.assing( new TemplateBlock( 'block', f.block.value ) );
				t.assign( new TemplateVar( 'arg1'    , f.arg1.value ) );
				t.assign( new TemplateVar( 'arg2'    , f.arg2.value ) );
				t.assign( new TemplateVar( 'arg3'    , f.arg3.value ) );
				t.assign( new TemplateVar( 'array'   , new Array( f.arg1.value, f.arg2.value, f.arg3.value ) ) );
				t.assign( new TemplateVar( 'object'  , {a1:f.arg1.value, a2:f.arg2.value, a3:f.arg3.value} ) );
				f.result.value = t.parse( f.block.value );
			}
		</script>
	</head>
	<body>

		<form name="testform">
			<textarea name="block" rows="12" cols="150">
Hello world! {arg1} {arg2} {arg3}
{* 2 3} = 6, {- 2 3}, {+ * 2 3 arg3}
{. array 0}={. object a1}
{foreach array block item}
<!-- BEGIN block -->
It's {. item key}: {. item val}
<!-- END block -->
			</textarea>

			<br>arg1: <input type="text" name="arg1" value="val1">
			<br>arg2: <input type="text" name="arg2" value="val2">
			<br>arg3: <input type="text" name="arg3" value="10">

			<br>
			<input type="button" onclick="test()" value=" test !!! ">
			<input type="reset" value=" clear ">

			<br>
			<textarea name="result" rows="12" cols="150"> </textarea>
		</form>


	</body>
</html>



